var loop_count = 0;

function tarai(x, y, z) {
	++loop_count;

    return (y < x
            ? tarai(tarai(x-1, y, z), tarai(y-1, z, x), tarai(z-1, x, y))
            : y);

	//if (y < x)
    //    return tarai(tarai(x-1, y, z), tarai(y-1, z, x), tarai(z-1, x, y));
    //return y;
}

print(tarai(12, 6, 0));
print(loop_count);

